﻿using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	// Token: 0x02000911 RID: 2321
	internal class XGuildCollectDocument : XDocComponent
	{
		// Token: 0x17002B6A RID: 11114
		// (get) Token: 0x06008BF7 RID: 35831 RVA: 0x0012D3D4 File Offset: 0x0012B5D4
		public override uint ID
		{
			get
			{
				return XGuildCollectDocument.uuID;
			}
		}

		// Token: 0x17002B6B RID: 11115
		// (get) Token: 0x06008BF8 RID: 35832 RVA: 0x0012D3EC File Offset: 0x0012B5EC
		public GuildCampPartyReward RewardReader
		{
			get
			{
				return XGuildCollectDocument._rewardReader;
			}
		}

		// Token: 0x17002B6C RID: 11116
		// (get) Token: 0x06008BF9 RID: 35833 RVA: 0x0012D404 File Offset: 0x0012B604
		public bool ActivityState
		{
			get
			{
				return this._activityState;
			}
		}

		// Token: 0x06008BFA RID: 35834 RVA: 0x0012D41C File Offset: 0x0012B61C
		public static void Execute(OnLoadedCallback callback = null)
		{
			XGuildCollectDocument.AsyncLoader.AddTask("Table/GuildCampPartyReward", XGuildCollectDocument._rewardReader, false);
			XGuildCollectDocument.AsyncLoader.Execute(callback);
		}

		// Token: 0x06008BFB RID: 35835 RVA: 0x00114AD5 File Offset: 0x00112CD5
		protected override void EventSubscribe()
		{
			base.EventSubscribe();
		}

		// Token: 0x06008BFC RID: 35836 RVA: 0x0012D441 File Offset: 0x0012B641
		public override void OnAttachToHost(XObject host)
		{
			base.OnAttachToHost(host);
			this._activityState = false;
			this._lotteryMachineState = false;
		}

		// Token: 0x06008BFD RID: 35837 RVA: 0x0012D45C File Offset: 0x0012B65C
		public override void OnEnterSceneFinally()
		{
			base.OnEnterSceneFinally();
			bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_GUILD_HALL;
			if (flag)
			{
				this._lotteryWaitTime = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryWaitTime"));
				this._lotteryProcessText = XStringDefineProxy.GetString("GuildCollectProcessText");
				this._lotteryProcessTips = XStringDefineProxy.GetString("GuildCollectProcessTips");
				this.LotteryTimes = int.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryTimes"));
				this.GuildCollecLotteryCD = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryCD"));
				List<int> intList = XSingleton<XGlobalConfig>.singleton.GetIntList("GuildCollectNpcShowNum");
				XQualitySetting.ESetting quality = (XQualitySetting.ESetting)XQualitySetting.GetQuality();
				int num = XFastEnumIntEqualityComparer<XQualitySetting.ESetting>.ToInt(quality);
				bool flag2 = num > intList.Count - 1;
				if (flag2)
				{
					num = intList.Count - 1;
				}
				this._npcMaxShowNum = intList[num];
				this._npcRefreshMode = ((XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollectNpcRefreshMode") == "0") ? CollectNpcRefreshMode.Random : CollectNpcRefreshMode.Distance);
				this.NpcIndex.Clear();
				this.NpcList.Clear();
				this.NpcPool.Clear();
				this.LotteryMachineList.Clear();
				bool activityState = this._activityState;
				if (activityState)
				{
					this.RefreshTime(null);
					this.InitNpcList();
					bool lotteryMachineState = this._lotteryMachineState;
					if (lotteryMachineState)
					{
						this.SetLotteryMachineState(true, true);
					}
				}
				this.SetMainInterfaceBtnState(false);
			}
		}

		// Token: 0x06008BFE RID: 35838 RVA: 0x0012D5CC File Offset: 0x0012B7CC
		public int CheckLotteryCD(uint uid)
		{
			LotteryCD lotteryCD;
			bool flag = this.LotteryCDInfo.TryGetValue(uid, out lotteryCD);
			int result;
			if (flag)
			{
				bool flag2 = lotteryCD.Times < this.LotteryTimes;
				if (flag2)
				{
					lotteryCD.Times++;
					result = -1;
				}
				else
				{
					int num = (int)(Time.time - lotteryCD.LastLotteryTime - this.GuildCollecLotteryCD);
					bool flag3 = num >= 0;
					if (flag3)
					{
						lotteryCD.Times = 1;
						lotteryCD.LastLotteryTime = Time.time;
						result = -1;
					}
					else
					{
						result = -num;
					}
				}
			}
			else
			{
				lotteryCD = new LotteryCD();
				lotteryCD.Times = 1;
				lotteryCD.LastLotteryTime = Time.time;
				this.LotteryCDInfo[uid] = lotteryCD;
				result = -1;
			}
			return result;
		}

		// Token: 0x06008BFF RID: 35839 RVA: 0x0012D680 File Offset: 0x0012B880
		public void SetActivityState(bool state)
		{
			bool flag = this._activityState != state;
			if (flag)
			{
				this._activityState = state;
				XSingleton<XDebug>.singleton.AddGreenLog("set guildcollect state = ", state.ToString(), null, null, null, null);
				bool flag2 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_GUILD_HALL;
				if (flag2)
				{
					bool activityState = this._activityState;
					if (activityState)
					{
						this.RefreshTime(null);
						this.InitNpcList();
					}
					else
					{
						foreach (KeyValuePair<uint, uint> keyValuePair in this.NpcIndex)
						{
							XSingleton<XEntityMgr>.singleton.DestroyNpc(keyValuePair.Value);
						}
						for (int i = 0; i < this.NpcPool.Count; i++)
						{
							XSingleton<XEntityMgr>.singleton.DestroyNpc(this.NpcPool[i]);
						}
						this.NpcIndex.Clear();
						this.NpcList.Clear();
						this.NpcPool.Clear();
					}
				}
				bool flag3 = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
				if (flag3)
				{
					DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.OnGuildSysChange();
				}
			}
		}

		// Token: 0x06008C00 RID: 35840 RVA: 0x0012D7CC File Offset: 0x0012B9CC
		public void InitNpcList()
		{
			int num = this._npcMaxShowNum;
			this.NORMALNAME = XStringDefineProxy.GetString("GuildCollectSummonNormal");
			this.SPECIALNAME = XStringDefineProxy.GetString("GuildCollectSummonSpecial");
			uint num2 = 101U;
			for (;;)
			{
				XNpcInfo.RowData byNPCID = XSingleton<XEntityMgr>.singleton.NpcInfo.GetByNPCID(num2);
				bool flag = byNPCID == null || byNPCID.NPCType != 4U;
				if (flag)
				{
					break;
				}
				XNpc xnpc = XSingleton<XEntityMgr>.singleton.CreateNpc(num2, true);
				xnpc.EngineObject.Position = XGameUI.Far_Far_Away;
				this.NpcPool.Add(num2);
				num--;
				bool flag2 = num <= 0;
				if (flag2)
				{
					break;
				}
				num2 += 1U;
			}
		}

		// Token: 0x06008C01 RID: 35841 RVA: 0x0012D87C File Offset: 0x0012BA7C
		public void SyncNpcList(List<GuildCampSpriteInfo> list)
		{
			HashSet<uint> hashSet = new HashSet<uint>();
			for (int i = 0; i < list.Count; i++)
			{
				hashSet.Add(list[i].sprite_id);
			}
			for (int j = this.NpcList.Count - 1; j >= 0; j--)
			{
				bool flag = hashSet.Contains(this.NpcList[j].id);
				if (flag)
				{
					hashSet.Remove(this.NpcList[j].id);
				}
				else
				{
					this.SetNpcInValid(j);
					this.NpcList.RemoveAt(j);
				}
			}
			bool flag2 = false;
			for (int k = 0; k < list.Count; k++)
			{
				bool flag3 = hashSet.Contains(list[k].sprite_id);
				if (flag3)
				{
					flag2 = true;
					Vector3 pos;
					pos = new Vector3((float)(list[k].position >> 16) / 100f, 0f, (float)(list[k].position & 65535) / 100f);
					string name = string.IsNullOrEmpty(list[k].summoner) ? this.NORMALNAME : string.Format("{0}{1}", list[k].summoner, this.SPECIALNAME);
					this.NpcList.Add(new CollectNpcInfo(list[k].sprite_id, pos, name));
				}
			}
			bool flag4 = flag2;
			if (flag4)
			{
				this.SortNpcByMode(this._npcRefreshMode);
			}
			this.DealWithNpcList();
		}

		// Token: 0x06008C02 RID: 35842 RVA: 0x0012DA2C File Offset: 0x0012BC2C
		public void OnMeetNpc(uint uid)
		{
			bool flag = this.NpcIndex.ContainsValue(uid);
			if (flag)
			{
				foreach (KeyValuePair<uint, uint> keyValuePair in this.NpcIndex)
				{
					bool flag2 = keyValuePair.Value == uid;
					if (flag2)
					{
						bool flag3 = this._lastSendNpcID == keyValuePair.Key && Time.time < this._lastSendNpcTime;
						if (flag3)
						{
							return;
						}
						RpcC2G_GetGuildCamPartyRandItem rpcC2G_GetGuildCamPartyRandItem = new RpcC2G_GetGuildCamPartyRandItem();
						rpcC2G_GetGuildCamPartyRandItem.oArg.query_type = 2U;
						rpcC2G_GetGuildCamPartyRandItem.oArg.npc_id = keyValuePair.Key;
						XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetGuildCamPartyRandItem);
						this._lastSendNpcTime = Time.time + 0.5f;
						return;
					}
				}
			}
			XSingleton<UiUtility>.singleton.ShowSystemTip(ErrorCode.ERR_GUILDACMPPATY_SPRITE_ONTEXIST, "fece00");
		}

		// Token: 0x06008C03 RID: 35843 RVA: 0x0012DB2C File Offset: 0x0012BD2C
		public void OnMeetLottery(uint uid)
		{
			bool flag = DlgBase<GuildInheritProcessDlg, GuildInheritProcessBehaviour>.singleton.IsVisible();
			if (!flag)
			{
				int num = this.CheckLotteryCD(uid);
				bool flag2 = num != -1;
				if (flag2)
				{
					XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("GuildCollectLotteryCDTips"), num), "fece00");
				}
				else
				{
					this._lastMeetLotteryUid = uid;
					DlgBase<GuildInheritProcessDlg, GuildInheritProcessBehaviour>.singleton.ShowProcess(this._lotteryWaitTime, this._lotteryProcessText, this._lotteryProcessTips, new GuildInheritProcessDlg.OnSliderProcessEnd(this.QueryLottery));
					this.SetMoveState(false);
					XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(uid);
					bool flag3 = npc == null;
					if (!flag3)
					{
						npc.ShowUp(null);
						bool flag4 = npc != null;
						if (flag4)
						{
							XSingleton<XAudioMgr>.singleton.PlaySound(npc, AudioChannel.Motion, "Audio/UI/UI_rabbit");
						}
						XSingleton<XTimerMgr>.singleton.SetTimer(float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecBoxFxTime")), new XTimerMgr.ElapsedEventHandler(this.DelayCreateLotteryBoxFx), uid);
						string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxNum").Split(new char[]
						{
							'='
						});
						bool flag5 = array.Length < 2;
						if (!flag5)
						{
							int num2 = XSingleton<XCommon>.singleton.RandomInt(int.Parse(array[0]), int.Parse(array[1]) + 1);
							array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxProduce").Split(new char[]
							{
								'='
							});
							float min = float.Parse(array[0]);
							float max = float.Parse(array[1]);
							for (int i = 0; i < num2; i++)
							{
								XSingleton<XTimerMgr>.singleton.SetTimer(XSingleton<XCommon>.singleton.RandomFloat(min, max), new XTimerMgr.ElapsedEventHandler(this.DelayCreateLotteryFlyFx), uid);
							}
						}
					}
				}
			}
		}

		// Token: 0x06008C04 RID: 35844 RVA: 0x0012DCFC File Offset: 0x0012BEFC
		public void DelayCreateLotteryBoxFx(object o)
		{
			uint id = (uint)o;
			XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(id);
			bool flag = npc == null;
			if (!flag)
			{
				bool flag2 = this._lotteryBoxFx != null;
				if (flag2)
				{
					XSingleton<XFxMgr>.singleton.DestroyFx(this._lotteryBoxFx, true);
				}
				this._lotteryBoxFx = XSingleton<XFxMgr>.singleton.CreateFx(XGuildCollectDocument.LotteryBoxFXPATH, null, true);
				this._lotteryBoxFx.Play(npc.EngineObject.Position, Quaternion.identity, Vector3.one, 1f);
			}
		}

		// Token: 0x06008C05 RID: 35845 RVA: 0x0012DD84 File Offset: 0x0012BF84
		public void DelayCreateLotteryFlyFx(object o)
		{
			uint id = (uint)o;
			XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(id);
			bool flag = npc == null || XSingleton<XEntityMgr>.singleton.Player == null;
			if (!flag)
			{
				this.CreatLotteryFx(npc.EngineObject.Position, XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position + new Vector3(0f, 0.3f));
			}
		}

		// Token: 0x06008C06 RID: 35846 RVA: 0x0012DDF8 File Offset: 0x0012BFF8
		public void QueryLottery()
		{
			this.SetMoveState(true);
			RpcC2G_GetGuildCamPartyRandItem rpcC2G_GetGuildCamPartyRandItem = new RpcC2G_GetGuildCamPartyRandItem();
			rpcC2G_GetGuildCamPartyRandItem.oArg.query_type = 1U;
			rpcC2G_GetGuildCamPartyRandItem.oArg.npc_id = this._lastMeetLotteryUid;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetGuildCamPartyRandItem);
		}

		// Token: 0x06008C07 RID: 35847 RVA: 0x0012DE40 File Offset: 0x0012C040
		public void SetMoveState(bool state)
		{
			bool flag = XSingleton<XEntityMgr>.singleton.Player != null && XSingleton<XEntityMgr>.singleton.Player.Nav != null;
			if (flag)
			{
				XSingleton<XEntityMgr>.singleton.Player.Nav.Interrupt();
				XSingleton<XEntityMgr>.singleton.Player.Nav.Enabled = state;
			}
			XSingleton<XInput>.singleton.Freezed = !state;
		}

		// Token: 0x06008C08 RID: 35848 RVA: 0x0012DEB0 File Offset: 0x0012C0B0
		public void DealWithNpcList()
		{
			bool flag = this._npcRefreshMode == CollectNpcRefreshMode.Distance;
			if (flag)
			{
				this.NpcList.Sort(new Comparison<CollectNpcInfo>(this.Compare));
			}
			int num = this._npcMaxShowNum;
			for (int i = 0; i < this.NpcList.Count; i++)
			{
				bool flag2 = this.NpcIndex.ContainsKey(this.NpcList[i].id);
				if (flag2)
				{
					num--;
				}
			}
			bool flag3 = num > 0;
			if (flag3)
			{
				for (int j = 0; j < this.NpcList.Count; j++)
				{
					bool use = this.NpcList[j].use;
					if (!use)
					{
						bool flag4 = !this.NpcIndex.ContainsKey(this.NpcList[j].id);
						if (flag4)
						{
							this.CreateNpc(this.NpcList[j].pos, this.NpcList[j].id, this.NpcList[j].name);
							num--;
							bool flag5 = num <= 0;
							if (flag5)
							{
								break;
							}
						}
					}
				}
			}
		}

		// Token: 0x06008C09 RID: 35849 RVA: 0x0012DFF8 File Offset: 0x0012C1F8
		private int Compare(CollectNpcInfo x, CollectNpcInfo y)
		{
			bool flag = x.id == y.id;
			int result;
			if (flag)
			{
				result = 0;
			}
			else
			{
				float num = Vector3.Distance(x.pos, XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position);
				float num2 = Vector3.Distance(y.pos, XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position);
				result = ((num > num2) ? 1 : -1);
			}
			return result;
		}

		// Token: 0x06008C0A RID: 35850 RVA: 0x0012E068 File Offset: 0x0012C268
		public void SortNpcByMode(CollectNpcRefreshMode mode)
		{
			bool flag = mode == CollectNpcRefreshMode.Distance;
			if (flag)
			{
				this.NpcList.Sort(new Comparison<CollectNpcInfo>(this.Compare));
			}
			else
			{
				XSingleton<UiUtility>.singleton.Shuffle<CollectNpcInfo>(ref this.NpcList);
			}
		}

		// Token: 0x06008C0B RID: 35851 RVA: 0x0012E0AC File Offset: 0x0012C2AC
		public void SetNpcInValid(int index)
		{
			uint num = 0U;
			bool flag = this.NpcIndex.TryGetValue(this.NpcList[index].id, out num);
			if (flag)
			{
				this.ReturnPool(num);
				this.NpcIndex.Remove(this.NpcList[index].id);
				bool flag2 = XSingleton<XInput>.singleton.LastNpc != null && XSingleton<XInput>.singleton.LastNpc.TypeID == num;
				if (flag2)
				{
					bool flag3 = XSingleton<XEntityMgr>.singleton.Player != null && XSingleton<XEntityMgr>.singleton.Player.Nav != null;
					if (flag3)
					{
						XSingleton<XEntityMgr>.singleton.Player.Nav.Interrupt();
					}
					XSingleton<XInput>.singleton.LastNpc = null;
				}
			}
		}

		// Token: 0x06008C0C RID: 35852 RVA: 0x0012E178 File Offset: 0x0012C378
		public void ReturnPool(uint uid)
		{
			XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(uid);
			bool flag = npc != null;
			if (flag)
			{
				npc.EngineObject.Position = XGameUI.Far_Far_Away;
				this.NpcPool.Add(uid);
			}
		}

		// Token: 0x06008C0D RID: 35853 RVA: 0x0012E1BC File Offset: 0x0012C3BC
		public void CreateNpc(Vector3 pos, uint npcID, string name)
		{
			bool flag = this.NpcPool.Count == 0;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("Get guildcollect Npc by pool error! It's a empty pool.", null, null, null, null, null);
			}
			else
			{
				int index = this.NpcPool.Count - 1;
				uint num = this.NpcPool[index];
				this.NpcPool.RemoveAt(index);
				XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(num);
				bool flag2 = npc == null;
				if (flag2)
				{
					XSingleton<XDebug>.singleton.AddErrorLog("create npc by pool error. id = ", num.ToString(), null, null, null, null);
				}
				else
				{
					bool flag3 = npc.BillBoard != null;
					if (flag3)
					{
						npc.BillBoard.OnGuildCollectNpcNameChange(name);
					}
					npc.EngineObject.Position = pos;
					npc.EngineObject.LocalEulerAngles = new Vector3(0f, XSingleton<XCommon>.singleton.RandomFloat(-180f, 180f), 0f);
					this.NpcIndex[npcID] = num;
				}
			}
		}

		// Token: 0x06008C0E RID: 35854 RVA: 0x0012E2BC File Offset: 0x0012C4BC
		public void SetLotteryMachineState(bool state, bool force = false)
		{
			bool flag = XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_GUILD_HALL;
			if (!flag)
			{
				bool flag2 = !force && state == this._lotteryMachineState;
				if (!flag2)
				{
					this._lotteryMachineState = state;
					bool lotteryMachineState = this._lotteryMachineState;
					if (lotteryMachineState)
					{
						uint num = 100U;
						for (;;)
						{
							XNpcInfo.RowData byNPCID = XSingleton<XEntityMgr>.singleton.NpcInfo.GetByNPCID(num);
							bool flag3 = byNPCID == null || byNPCID.NPCType != 5U;
							if (flag3)
							{
								break;
							}
							XNpc xnpc = XSingleton<XEntityMgr>.singleton.CreateNpc(num, true);
							this.LotteryMachineList.Add(num);
							XFx xfx = XSingleton<XFxMgr>.singleton.CreateFx(XGuildCollectDocument.m_fxPath, null, true);
							bool flag4 = xfx != null && xnpc != null;
							if (flag4)
							{
								this._fxList.Add(xfx);
								xfx.Play(xnpc.EngineObject, new Vector3(-0.05f, xnpc.Height + 0.6f, 0f), Vector3.one, 1f, false, false, "", 0f);
							}
							num -= 1U;
						}
					}
					else
					{
						for (int i = 0; i < this.LotteryMachineList.Count; i++)
						{
							XSingleton<XEntityMgr>.singleton.DestroyNpc(this.LotteryMachineList[i]);
						}
						for (int j = 0; j < this._fxList.Count; j++)
						{
							bool flag5 = this._fxList[j] != null;
							if (flag5)
							{
								XSingleton<XFxMgr>.singleton.DestroyFx(this._fxList[j], true);
							}
						}
						this._fxList.Clear();
						this.LotteryMachineList.Clear();
					}
				}
			}
		}

		// Token: 0x06008C0F RID: 35855 RVA: 0x0012E490 File Offset: 0x0012C690
		public override void OnLeaveScene()
		{
			base.OnLeaveScene();
			this.NpcIndex.Clear();
			this.NpcList.Clear();
			this.NpcPool.Clear();
			this.LotteryMachineList.Clear();
			for (int i = 0; i < this._fxList.Count; i++)
			{
				bool flag = this._fxList[i] != null;
				if (flag)
				{
					XSingleton<XFxMgr>.singleton.DestroyFx(this._fxList[i], true);
				}
			}
			this._fxList.Clear();
			bool flag2 = this._lotteryFxLink.Count != 0;
			if (flag2)
			{
				LinkedListNode<ParabolaFx> next;
				for (LinkedListNode<ParabolaFx> linkedListNode = this._lotteryFxLink.First; linkedListNode != null; linkedListNode = next)
				{
					next = linkedListNode.Next;
					linkedListNode.Value.Destroy();
					this._lotteryFxLink.Remove(linkedListNode);
				}
				XSingleton<XDebug>.singleton.AddGreenLog("Clear guildcollect fx link, cout = ", this._lotteryFxLink.Count.ToString(), null, null, null, null);
			}
			bool flag3 = this._lotteryBoxFx != null;
			if (flag3)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(this._lotteryBoxFx, true);
				this._lotteryBoxFx = null;
			}
		}

		// Token: 0x06008C10 RID: 35856 RVA: 0x0012E5D2 File Offset: 0x0012C7D2
		public void SetMainInterfaceBtnState(bool state)
		{
			this.MainInterfaceBtnState = state;
			DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_GuildCollectMainInterface, true);
		}

		// Token: 0x06008C11 RID: 35857 RVA: 0x0012E5F0 File Offset: 0x0012C7F0
		public void QuerySummon()
		{
			SeqList<int> sequenceList = XSingleton<XGlobalConfig>.singleton.GetSequenceList("GuildCampSummonSpiritCost", false);
			string text = string.Format(XStringDefineProxy.GetString("GuildCollectSummonTips"), XLabelSymbolHelper.FormatSmallIcon(sequenceList[0, 0]), sequenceList[0, 1]);
			text = XSingleton<UiUtility>.singleton.ReplaceReturn(text);
			string @string = XStringDefineProxy.GetString("COMMON_OK");
			string string2 = XStringDefineProxy.GetString("COMMON_CANCEL");
			XSingleton<UiUtility>.singleton.ShowModalDialog(text, @string, string2, new ButtonClickEventHandler(this.OnSummonSure));
		}

		// Token: 0x06008C12 RID: 35858 RVA: 0x0012E678 File Offset: 0x0012C878
		public bool OnSummonSure(IXUIButton btn)
		{
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			RpcC2G_GuildPartySummonSpirit rpc = new RpcC2G_GuildPartySummonSpirit();
			XSingleton<XClientNetwork>.singleton.Send(rpc);
			return true;
		}

		// Token: 0x06008C13 RID: 35859 RVA: 0x0012E6AC File Offset: 0x0012C8AC
		public void QueryGetRewardCount()
		{
			RpcC2G_GetGuildPartyReceiveInfo rpc = new RpcC2G_GetGuildPartyReceiveInfo();
			XSingleton<XClientNetwork>.singleton.Send(rpc);
		}

		// Token: 0x06008C14 RID: 35860 RVA: 0x0012E6CC File Offset: 0x0012C8CC
		public void OnUseCountGet(List<MapIntItem> list)
		{
			this.CollectUseDict.Clear();
			for (int i = 0; i < list.Count; i++)
			{
				this.CollectUseDict[(uint)list[i].key] = (int)list[i].value;
			}
			bool flag = DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.IsVisible();
			if (flag)
			{
				DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.Refresh();
			}
		}

		// Token: 0x06008C15 RID: 35861 RVA: 0x0012E73C File Offset: 0x0012C93C
		public void QueryGetReward(uint id)
		{
			RpcC2G_GetGuildCampPartyReward rpcC2G_GetGuildCampPartyReward = new RpcC2G_GetGuildCampPartyReward();
			rpcC2G_GetGuildCampPartyReward.oArg.reward_id = id;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetGuildCampPartyReward);
		}

		// Token: 0x06008C16 RID: 35862 RVA: 0x000FEEFC File Offset: 0x000FD0FC
		protected override void OnReconnected(XReconnectedEventArgs arg)
		{
		}

		// Token: 0x06008C17 RID: 35863 RVA: 0x0012E76C File Offset: 0x0012C96C
		public void CreatLotteryFx(Vector3 startPos, Vector3 endPos)
		{
			string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxDuration").Split(new char[]
			{
				'='
			});
			bool flag = array.Length < 2;
			if (!flag)
			{
				float duration = XSingleton<XCommon>.singleton.RandomFloat(float.Parse(array[0]), float.Parse(array[1]));
				array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxSpeed").Split(new char[]
				{
					'='
				});
				bool flag2 = array.Length < 2;
				if (!flag2)
				{
					float speedY = XSingleton<XCommon>.singleton.RandomFloat(float.Parse(array[0]), float.Parse(array[1]));
					ParabolaFx value = new ParabolaFx(XGuildCollectDocument.LotteryFlyFXPATH, duration, speedY, startPos, endPos);
					this._lotteryFxLink.AddLast(value);
				}
			}
		}

		// Token: 0x06008C18 RID: 35864 RVA: 0x0012E82C File Offset: 0x0012CA2C
		public override void Update(float fDeltaT)
		{
			base.Update(fDeltaT);
			bool flag = !this._activityState;
			if (!flag)
			{
				bool flag2 = this._lotteryFxLink.Count == 0;
				if (!flag2)
				{
					LinkedListNode<ParabolaFx> next;
					for (LinkedListNode<ParabolaFx> linkedListNode = this._lotteryFxLink.First; linkedListNode != null; linkedListNode = next)
					{
						next = linkedListNode.Next;
						bool flag3 = !linkedListNode.Value.Update();
						if (flag3)
						{
							this._lotteryFxLink.Remove(linkedListNode);
						}
					}
				}
			}
		}

		// Token: 0x06008C19 RID: 35865 RVA: 0x0012E8A9 File Offset: 0x0012CAA9
		public void SetTime(uint leftTime)
		{
			this.SignTime = XSingleton<UiUtility>.singleton.GetMachineTime();
			this.LeftTime = leftTime;
			this.SUMMONLEFTTIME = XSingleton<XGlobalConfig>.singleton.GetInt("GuildCampSummonSpiritTime");
		}

		// Token: 0x06008C1A RID: 35866 RVA: 0x0012E8D8 File Offset: 0x0012CAD8
		public void RefreshTime(object o = null)
		{
			int num = (int)(XSingleton<UiUtility>.singleton.GetMachineTime() - this.SignTime);
			num = (int)(this.LeftTime - (uint)num);
			int num2 = num - this.SUMMONLEFTTIME;
			bool flag = num < 0;
			if (flag)
			{
				num = 0;
			}
			bool flag2 = num2 < 0;
			if (flag2)
			{
				num2 = 0;
			}
			bool flag3 = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
			if (flag3)
			{
				DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshGuildCollectTime(num, num2);
			}
			bool flag4 = DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.IsVisible();
			if (flag4)
			{
				DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.RefreshTime(num);
			}
			this._hallTimeToken = XSingleton<XTimerMgr>.singleton.SetTimer(1f, new XTimerMgr.ElapsedEventHandler(this.RefreshTime), null);
		}

		// Token: 0x04002D00 RID: 11520
		public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("GuildCollectDocument");

		// Token: 0x04002D01 RID: 11521
		public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();

		// Token: 0x04002D02 RID: 11522
		private static GuildCampPartyReward _rewardReader = new GuildCampPartyReward();

		// Token: 0x04002D03 RID: 11523
		private bool _activityState = false;

		// Token: 0x04002D04 RID: 11524
		private bool _lotteryMachineState = false;

		// Token: 0x04002D05 RID: 11525
		public List<uint> NpcPool = new List<uint>();

		// Token: 0x04002D06 RID: 11526
		public List<uint> LotteryMachineList = new List<uint>();

		// Token: 0x04002D07 RID: 11527
		public Dictionary<uint, uint> NpcIndex = new Dictionary<uint, uint>();

		// Token: 0x04002D08 RID: 11528
		public List<CollectNpcInfo> NpcList = new List<CollectNpcInfo>();

		// Token: 0x04002D09 RID: 11529
		private int _npcMaxShowNum;

		// Token: 0x04002D0A RID: 11530
		private CollectNpcRefreshMode _npcRefreshMode;

		// Token: 0x04002D0B RID: 11531
		private uint _lastMeetLotteryUid;

		// Token: 0x04002D0C RID: 11532
		private float _lotteryWaitTime;

		// Token: 0x04002D0D RID: 11533
		private string _lotteryProcessText;

		// Token: 0x04002D0E RID: 11534
		private string _lotteryProcessTips;

		// Token: 0x04002D0F RID: 11535
		private uint _lastSendNpcID = 0U;

		// Token: 0x04002D10 RID: 11536
		private float _lastSendNpcTime;

		// Token: 0x04002D11 RID: 11537
		public Dictionary<uint, int> CollectUseDict = new Dictionary<uint, int>();

		// Token: 0x04002D12 RID: 11538
		public bool MainInterfaceBtnState = false;

		// Token: 0x04002D13 RID: 11539
		public List<XFx> _fxList = new List<XFx>();

		// Token: 0x04002D14 RID: 11540
		private static readonly string m_fxPath = "Effects/FX_Particle/Scene/Lzg_scene/rwts_05";

		// Token: 0x04002D15 RID: 11541
		public double SignTime;

		// Token: 0x04002D16 RID: 11542
		public uint LeftTime;

		// Token: 0x04002D17 RID: 11543
		private int SUMMONLEFTTIME = 300;

		// Token: 0x04002D18 RID: 11544
		private string NORMALNAME = "";

		// Token: 0x04002D19 RID: 11545
		private string SPECIALNAME = "";

		// Token: 0x04002D1A RID: 11546
		private uint _hallTimeToken;

		// Token: 0x04002D1B RID: 11547
		private LinkedList<ParabolaFx> _lotteryFxLink = new LinkedList<ParabolaFx>();

		// Token: 0x04002D1C RID: 11548
		private XFx _lotteryBoxFx;

		// Token: 0x04002D1D RID: 11549
		private static readonly string LotteryFlyFXPATH = "Effects/FX_Particle/UIfx/UI_ghpd_rabbit_Clip02";

		// Token: 0x04002D1E RID: 11550
		private static readonly string LotteryBoxFXPATH = "Effects/FX_Particle/UIfx/UI_ghpd_rabbit_Clip01";

		// Token: 0x04002D1F RID: 11551
		public Dictionary<uint, LotteryCD> LotteryCDInfo = new Dictionary<uint, LotteryCD>();

		// Token: 0x04002D20 RID: 11552
		public int LotteryTimes = 3;

		// Token: 0x04002D21 RID: 11553
		public float GuildCollecLotteryCD = 120f;
	}
}
